﻿
using Dapper;
using System;
using System.Data;
using System.Linq;
namespace hCommand.mySql {
    internal class SequenceIdServer :AbsSequenceIdServer, ISequenceIdServer {
        public override long querySequence(IDbConnection conn ,IDbTransaction trans) {
            if( conn == null ) {
               
                return opConn().Query<long>("SELECT NEXTVAL()").Single();
            } else {
                return conn.Query<long>("SELECT NEXTVAL()" ,null ,trans).Single();
            }

        }

        public override DateTime GetTime() {
            return readConn().Query<DateTime>("select now()").Single();
        }
    }
}
